﻿Namespace Functions
    Public Class MetisViewFunction
        Inherits MetisResultFunction


        Sub New(ByVal MetisCore As MetisCore, Optional ByVal [Namespace] As MetisNamespace = Nothing)
            _MetisCore = MetisCore
            _Namespace = [Namespace]
            _ID = _MetisCore.GetTemporaryID
            _Name = String.Format(My.Resources.Metis_Dim_NewName.ToString, _ID * -1)
            _Table = New DB.DBTable(_MetisCore, "", DB.DBTableType.Table)
            _IsModified = True
            _LoadState = MetisLoadState.NewDefinition
            _Joins = New MetisJoinList()
            _FunctionReferences = New MetisRefFunctionList(_MetisCore, Me)
            _OpSets = New MetisSetOpList(_MetisCore, Me)

            _BackupJoins = New MetisJoinList()
            _BackupFunctionReferences = New MetisRefFunctionList(_MetisCore, Me)
            _BackupOpSets = New MetisSetOpList(_MetisCore, Me)
        End Sub


        Sub New(ByVal MetisCore As MetisCore, ByVal [Namespace] As MetisNamespace, ByVal ID As Integer, ByVal Name As String, ByVal Annotation As String, _
                ByVal Table As DB.DBTable, ByVal ModifiedOn As Date, ByVal CreatedOn As Date, ByVal Level As Integer)

            _MetisCore = MetisCore
            _Namespace = [Namespace]
            _UsedByFunctions = New MetisFunctionList(_MetisCore, Me)
            _UsesFunctions = New MetisFunctionList(_MetisCore, Me)
            _ID = ID
            _Name = Name
            _BackupName = Name
            _Annotation = Annotation
            _BackupAnnotation = Annotation
            _Table = Table
            _ModifiedOn = ModifiedOn
            _CreatedOn = CreatedOn
            _Level = Level
            _LoadState = MetisLoadState.NotLoaded

            _Joins = New MetisJoinList()
            _FunctionReferences = New MetisRefFunctionList(_MetisCore, Me)
            _OpSets = New MetisSetOpList(_MetisCore, Me)

            _BackupJoins = New MetisJoinList()
            _BackupFunctionReferences = New MetisRefFunctionList(_MetisCore, Me)
            _BackupOpSets = New MetisSetOpList(_MetisCore, Me)
        End Sub

        Public Overrides Sub Save()

        End Sub

        Public Overrides ReadOnly Property FunctionType() As MetisFunctionType
            Get
                Return MetisFunctionType.View
            End Get
        End Property

    End Class
End Namespace